﻿using CloudDcPc.Entity;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CloudDcPc
{
    /// <summary>
    /// Checkout_gz.xaml 的交互逻辑
    /// </summary>
    public partial class CheckOutGzDlg : Window
    {
        CheckOutGz checkOutGz = null;

        public CheckOutGzDlg(CheckOutGz checkOutGz)
        {
            InitializeComponent();

            this.checkOutGz = checkOutGz;

            ObservableCollection<Gz> list_gz = App.GzBean.GetAllGz();
            cb_gz.ItemsSource = list_gz;
        }

        /// <summary>
        /// 关闭按钮
        /// </summary>
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
        /// <summary>
        /// 选择按钮
        /// </summary>
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            Gz gz = (Gz)cb_gz.SelectedItem;

            checkOutGz.Sign_name = gz.Sign_name;
            checkOutGz.Department = gz.Department;
            checkOutGz.Phone = gz.Phone;
            checkOutGz.Doer = gz.Doer;
            checkOutGz.Approver = gz.Approver;

            this.Close();
        }

        private void cb_gz_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            main_grid.DataContext = (Gz)cb_gz.SelectedItem;
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}
